/**
 *Copyright (c) 2024 watereyes
 * safetymanagement is licensed under Mulan PubL v2.
 * You can use this software according to the terms and conditions of the Mulan
 * PubL v2.
 * You may obtain a copy of Mulan PubL v2 at:
 *          http://license.coscl.org.cn/MulanPubL-2.0
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PubL v2 for more details.
 */
package com.koron.safetytask.service.api;

import com.koron.common.bean.StaffBean;
import com.koron.common.domain.DataBean;
import com.koron.safetytask.domain.CustomFormData;
import com.koron.safetytask.domain.UserTask;
import com.koron.safetytask.domain.UserTaskFollow;
import com.koron.safetytask.domain.UserTaskResult;
import org.springframework.web.multipart.MultipartFile;
import org.swan.bean.MessageBean;

import java.util.Date;
import java.util.List;

public interface UserTaskService {
    /**
     * 保存用户任务
     *
     * @param userTask
     * @return
     */
    MessageBean<Integer> save(StaffBean user, UserTask userTask, Integer operatorType,MultipartFile[] files, String keepAttAddress, String delAttAddress);

    /**
     * 根据主键删除用户任务
     *
     * @param id
     * @return
     */
    MessageBean<Integer> delete(String id);

    /**
     * 根据主键获取用户任务
     *
     * @param id
     * @return
     */
    MessageBean<UserTask> query(String id);

    /**
     * 获取作为指派人的用户任务列表
     *
     * @param initiatorCode
     * @param taskName
     * @param deadline
     * @param start
     * @param rows
     * @return
     */
    MessageBean<DataBean<UserTask>> queryForInitiator(String initiatorCode, String taskName, Date deadline, Integer start, Integer rows,String keyword);

    /**
     * 作为接收人获取的任务列表(根据state值不同查待办和已办)
     *
     * @param userCode
     * @param state
     * @param taskName
     * @param deadline
     * @param start
     * @param rows
     * @return
     */
    MessageBean<DataBean<UserTask>> queryForReceiver(String userCode, Integer state, String taskName, Date deadline, Integer start, Integer rows,String keyword);

    /**
     * 根据指定条件获取所有任务列表
     *
     * @param taskName
     * @param deadline
     * @param receiverCode
     * @param start
     * @param rows
     * @return
     */
    MessageBean<DataBean<UserTask>> queryAllByCondition(String taskName, Date deadline, String receiverCode, Integer start, Integer rows);

    /**
     * 保存任务结果
     *
     * @param result
     * @return
     */
    MessageBean<Integer> saveUserTaskResult(StaffBean user,
                                            UserTaskResult result,
                                            MultipartFile[] files,
                                            String keepAttAddress,
                                            String delAttAddress,
                                            List<CustomFormData> beanList,
                                            String tbaleCode,
                                            String approver,String title,String description);


    /**
     * 根据任务id查询任务结果
     *
     * @param taskId
     * @return
     */
    MessageBean<List<UserTaskResult>> queryUserTaskResultByTaskId(StaffBean user, String taskId);

    /**
     * 根据任务id和登录人查询当前登录人填写的任务执行结果
     * @param user
     * @param taskId
     * @return
     */
    MessageBean<UserTaskResult> queryResultByUserTaskIdAndExecutorCode(StaffBean user, String taskId);

    /**
     * 确认任务完成情况
     *
     * @param result
     * @return
     */
    MessageBean<Integer> confirmUserTaskResult(UserTaskResult result);

    /**
     * 新增用户关注
     *
     * @param taskFollow
     * @return
     */
    MessageBean<Integer> insetUserTaskFollow(UserTaskFollow taskFollow);

    /**
     * 根据主键批量取消任务关注
     *
     * @param idList
     * @return
     */
    MessageBean<Integer> batchDeleteTaskFollow(List<String> idList);

    /**
     * 根据关注人code获取关注的任务列表
     *
     * @param followerCode
     * @param start
     * @param rows
     * @return
     */
    MessageBean<DataBean<UserTask>> queryByFollewCode(String followerCode, Integer start, Integer rows,String keyword);

    MessageBean<DataBean<UserTask>> indexUnDeal(String userCode, Integer page, Integer pageSize);
}
